package com.company.management.controller.reward;


import com.company.management.domain.reward.vo.DepartmentVO;
import com.company.management.service.reward.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/api/dept")
public class DepartmentController {
 
    @Autowired
    private DepartmentService departmentService;
 
    @GetMapping("/getDepartmentsWithUsers")
    public ResponseEntity<List<DepartmentVO>> getAllDepartmentsWithUsers(@RequestParam(name="userId") Integer userId) {
        return  new ResponseEntity<>(departmentService.getAllDepartmentsWithUsers(userId), HttpStatus.OK);
    }
}